import request from "@/utils/request";

/**
 * 登录
 * @param params
 * @returns
 */
export function login(data) {
  return request<{ token: string }>({
    url: '/management/login/login',
    method: 'post',
    data
  })
}

/**
 * 登出
 * @param params
 * @returns
 */
export function logout(params: Api.logout.Option) {
  return request<string>({
    url: '/management/login/logout',
    method: 'post',
    params
  })
}

/**
 * 获取验证码
 * @param data 
 * @returns
 */
export function getCaptcha (data: {}) {
  return request<{
    uniqid: string
    content: string
  }>({
    url: '/management/login/getCaptcha',
    method: 'post',
    data
  })
}
/**
 * 获取微信扫码登录链接
 * @param data 
 * @returns
 */
export function getWxLoginUrl (data: {}) {
  return request<{
    uniqid: string
    content: string
  }>({
    url: '/management/login/getWxLoginUrl',
    method: 'post',
    data
  })
}
/**
 * 监听微信扫码登录状态
 * @param data 
 * @returns
 */
export function checkWxLoginStatus (data: {}) {
  return request<{
    uniqid: string
    content: string
  }>({
    url: '/management/login/checkWxLoginStatus',
    method: 'post',
    data
  })
}
/**
 * 通过openid获取账号
 * @param params
 * @returns
 */
export function getUsers(params: Api.logout.Option) {
  return request<string>({
    url: '/wx/login/getUsers',
    method: 'post',
    params
  })
}
/**
 * 选择账号确认登录
 * @param params
 * @returns
 */
export function managerLogin(params: Api.logout.Option) {
  return request<string>({
    url: '/wx/login/managerLogin',
    method: 'post',
    params
  })
}